<template>
      <div class="registerWrap">
            <!-- 注册页面头部 begin -->
            <header class="registerHeader">
                  <i class="retreat" @click="$router.push('/mine/login')"></i>
                  <span>京东注册</span>
            </header>
            <!-- 注册页面头部 begin -->

            <!-- 注册页面主体部分 begin -->
            <section class="page">
                  <div>
                        <div class="registerInput">
                              <span class="CountryNum">+86</span>
                              <span class="countryMore"></span>
                              <input type="text" placeholder="请输入手机号" class="loginWrite writePhone" @input="imgShow" @blur="imgCancel" v-model="regPhone">
                              <i class="usernameImg" style="display:none" @click="regEmpty"></i>
                        </div>
                        <div class="registerValidate">
                              <a class="registerC" @click="clickValid">点击完成验证</a>
                        </div>
                        <div style="text-align:center">
                              <span class="messagePoint" style="display:none">手机号格式错误</span>
                        </div>
                  </div>
            </section>
            <!-- 注册页面主体部分 end -->

            <!-- 注册页面的对话框部分 begin -->
            <div class="registerCover">
                  <div class="registerProtocol">
                        <p class="protocolTitle">{{protocol.title}}</p>
                        <div class="protocolLine"></div>
                        <div class="protocolCont">{{protocol.content}}</div>
                        <div>
                              <div class="protocolAgreen">{{protocol.agreen}}</div>
                              <a href="#/mine/login" class="notAgreen">不同意</a>
                              <span class="iAgreenPro" @click="agreenPro">同意</span>
                        </div>
                  </div>
            </div>
            <!-- 注册页面的对话框部分 end -->
      </div>
</template>
<script>
export default {
      data(){
            return{
                  protocol:{},
                  regPhone:''
            }
      },
      methods:{
            // 协议部分请求
            getProtocol(){
                  this.jq.get(this.apiurl+'/register/protocol').done(result=>{
                        if(result.error==0){
                              this.protocol=result.data
                        }
                  })
            },
            // 遮罩层
            agreenPro(){
                  this.jq('.registerCover').css('display','none')
            },
            // 清空图片出现
            imgShow(){
                  var tg=event.target
                  setTimeout(()=>{this.jq(tg).next().css('display','block')},100)
            },
            // 清空图片消失
            imgCancel(){
                  var tg=event.target
                  setTimeout(()=>{this.jq(tg).next().css('display','none')},100)
            },
            regEmpty(){
                  this.regPhone=''
                  this.jq(event.target).prev('input').focus()
            },
            clickValid(){
                  var reg=/^1[3456789]\d{9}$/
                  if(!reg.test(this.regPhone)){
                        this.jq('.messagePoint').fadeTo(200,0.9).delay(2000).fadeOut(1500)
                  }
            }
      },
      created(){
            // 调用协议请求方法
            this.getProtocol()
      }
      
}
</script>
<style>
/*注册页面头部设置 begin*/ 
.registerWrap{
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      right: 0;
      background:#f7f7f7;
}
.registerHeader{
      width: 100%;
      height: 3.6rem;
      line-height: 3.6rem;
      text-align: center;
      color: #616161;
      font-size: 17px;
      background: #f9f9f9;
      border-bottom: 1px solid #bbb;
}
.retreat{
      width: 2rem;
      height: 2rem;
      position: absolute;
      left: 1rem;
      top: 1rem;
      background: url('/static/img/login.png') no-repeat 0 -61px;
      background-size:1.8rem auto;
}
/*注册页面头部设置 end*/ 

/*注册页面主体 begin*/ 
.page{
      padding: 1.5rem;
}
.registerInput{
      height: 4rem;
      line-height: 4rem;
      background: white;
      box-sizing: border-box; 
      font-size: 14px;
      position: relative;
      margin-top:1rem;
}
.CountryNum{
      margin-left:1.3rem;
      font-size: 13px;
}
.countryMore{
      width: 0;
      height: 0;
      border-left: 4px solid transparent;
      border-right: 4px solid transparent;
      border-top: 5px solid #ABABAB;
      display: inline-block;
      margin: 0 4px 0 2px;
      padding-top: 1px;
}
.loginWrite{
      margin-left: 2.3rem;
      border: 0;
      outline: 0;
}
.usernameImg{
      width: 1.8rem;
      height: 1.8rem;
      position: absolute;
      top: 50%;
      margin-top: -0.9rem;
      right:1rem; 
      background:url('/static/img/iconBg.png') no-repeat;
      background-size: 100% auto;
}
.loginWrite::-webkit-input-placeholder{
    transform: scale(1.05);
    transform-origin: left center;
    color:#ccc
}
.writePhone{
      margin-left:0;
}

.registerValidate{
      height: 3.8rem;
      line-height: 3.8rem;
      background: white url('/static/img/init.gif') no-repeat 0.8rem center;
      border: 1px solid #409eff;
      border-radius: 2px;
      margin-top:1rem;
      background-size: 1.8rem;
      box-sizing: border-box;
      padding-left:3.2rem;
}
.registerC{
      color: #409eff;;
      font-size: 14px;
}
.messagePoint{
      display: inline-block;
      padding: 10px 14px;
      margin-top:20px ;
      background:rgba(0,0,0,0.8);
      color: white;
      border-radius: 4px;
      font-size: 10px;
}
/*注册页面主体 end*/ 

/*注册页面的对话框 begin*/ 
.registerCover{
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.5);
      z-index: 10;
}
.registerProtocol{
      position: absolute;
      bottom:0;
      box-sizing: border-box;
      width: 100%;
      padding: 0 1rem 1rem 1rem;
      z-index: 20;
      background: white;
      border-radius: 3px;
}
.protocolTitle{
      font-weight: bold;
      font-size: 18px;
      text-align: center;
      color: #000;
      line-height: 4rem;
}
.protocolLine{
    width: 100%;
    height: 1px;
    background: #d7d7d7;
    position: absolute;
    top: 3.8rem;
    left: -0.2rem;
}
.protocolCont{
      height: 19rem;
      overflow-y: auto;
      overflow-x: hidden;
      font-size: 13px;
}
.protocolAgreen{
      box-sizing: border-box;
      padding: 0.8rem 0;
      font-weight: bold;
}
.notAgreen{
      float: left;
      color: #000;
      margin-left: 1rem;
      background: white;
      border: 1px solid #d7d7d7;
      padding: 0.8rem 4.5rem;
      border-radius: 3px;
      font-size: 16px;
}
.iAgreenPro{
      float: right;
      margin-right: 1rem;
      border: 1px solid #E93B3D;
      background: #E93B3D;
      color: white;
      font-size:16px;
      border-radius: 3px;
      padding: 0.8rem 5.2rem;
}
/*注册页面的对话框 end*/ 
</style>


